//
//  NDIDCardStepTopView.swift
//  NyamanDana
//
//  Created by 李永彬 on 2025/10/28.
//

import SwiftUI

enum IDCardStepType: CaseIterable {
    case upload
    case faceReco
    case completed
    
    var title: String {
        switch self {
        case .upload:
            return "01"
        case .faceReco:
            return "02"
        case .completed:
            return "03"
        }
    }
    
    var description: String {
        switch self {
        case .upload:
            return localizedString("upload_info")
        case .faceReco:
            return localizedString("confirm_step")
        case .completed:
            return localizedString("face_step")
        }
    }
    
    var tipsImgName: String {
        switch self {
        case .upload:
            if WJAppEnvironment.shared.currentCountry == .indonesia {
                return "id_card_upload_icon_id"
            }

            return "id_card_upload_icon"
        case .faceReco:
            if WJAppEnvironment.shared.currentCountry == .indonesia {
                return "id_card_face_id"
            }
            return "id_card_face"
        case .completed:
            return ""
        }
    }
    
    var iconImgName: String {
        switch self {
        case .upload:
            return ""
        case .faceReco:
            return "people"
        case .completed:
            return "id_card_confirm"
        }
    }
}

struct NDIDCardStepTopView: View {
    let stepType: IDCardStepType
    let isSelected: Bool
    var body: some View {
        VStack(spacing: 10) {
            Text(stepType.title)
                .font(.system(size: 16, weight: .bold))
                .foregroundColor(isSelected ? Color(hex: "#FFFFFF") : Color(hex: "#AAAAAA"))
                .background(
                    Circle()
                        .fill(isSelected ? Color(hex: "#FD632B") : Color(hex: "#FFFFFF"))
                        .overlay(
                            Group {
                                if !isSelected {
                                    Circle()
                                        .stroke(Color(hex: "#AAAAAA"), lineWidth: 1)
                                }
                            }
                        )
                        .frame(width: 32, height: 32)
                )
                .frame(width: 32, height: 32)
            
            Text(stepType.description)
                .font(.system(size: 12))
                .foregroundColor(Color(hex: "#271F24"))
                .frame(maxWidth: .infinity)
                .padding(.horizontal, 1)
                .lineLimit(2)
        }
    }
}

